<?php
namespace app\mqtt\validate;
use think\Validate;
class Chat extends Validate {
    //验证字段
    protected $rule = [
        'logo' => ['require'],
        'create_time' => ['require','number'],
        'is_deleted' => ['require','number'],
        'status' => ['require','number'],
        'main_account_id' => ['require','number'],
        'create_account_id' => ['require','number'],
        'title' => ['require','number'],
        'info' => ['require'],
        'chat_type' => ['require'],
        'id' => ['require','number'],
    ];
    //返回消息
    protected $message = [
        'logo.require' => '标志必须',
        'create_time.require' => '创建时间必须',
        'create_time.number' => '创建时间不是数字',
        'is_deleted.require' => '已删除必须',
        'is_deleted.number' => '已删除不是数字',
        'status.require' => '状态必须',
        'status.number' => '状态不是数字',
        'main_account_id.require' => '管理员必须',
        'main_account_id.number' => '管理员不是数字',
        'create_account_id.require' => '创建账号id必须',
        'create_account_id.number' => '创建账号id不是数字',
        'title.require' => '账号id必须',
        'title.number' => '账号id不是数字',
        'info.require' => '简介必须',
        'chat_type.require' => '窗口类型必须',
        'id.require' => 'id必须',
        'id.number' => 'id不是数字',
    ];

    // except_id 场景
    public function sceneExcept_id(){
        return $this->only(['logo','create_time','is_deleted','status','main_account_id','create_account_id','title','info','chat_type']);
    }

    // only_id 场景
    public function sceneOnly_id(){
        return $this->only(['id']);
    }

    // all_field 场景
    public function sceneAll_field(){
        return $this->only(['logo','create_time','is_deleted','status','main_account_id','create_account_id','title','id','info','chat_type']);
    }
}
